/*
 * mcf_net.h
 *
 *  Created on: 2012-8-25
 *      Author: dietoad
 */

#ifndef MCF_NET_H_
#define MCF_NET_H_
#include "../types.h"
#ifdef __cplusplus
extern "C"
{
#endif


#define TCP SOCK_STREAM
#define UDP SOCK_DGRAM
#define PROTO_TCP IPPROTO_TCP
#define PROTO_UDP IPPROTO_UDP

#ifdef __WIN32__
typedef LINGER linger;
#elif linux
typedef i32 linger;
#endif
typedef int socket_fd;
typedef struct sockaddr_in sockaddr_in ;
typedef struct sockaddr sockaddr ;


typedef struct socket_t_
{
socket_fd sock_fd;
i8 *addr;
u16 port;
u8 type;
u8 protocl;
u64 back_log;
}socket_t;
i32 MCF_EXPORT   service_server(socket_t *sock_t);
i32 MCF_EXPORT   service_client(socket_t *sock_t);
#ifdef __cplusplus
}
#endif
#endif /* MCF_NET_H_ */
